home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-08-22 | 2.4 KB | 88 lines | [TEXT/CWIE] |
- // Release Version: $ ODF 2 $
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
-
- //=======================================================================
- #ifndef PART_H
- #include "Part.h"
- #endif
-
- #ifndef CONTENT_H
- #include "Content.h"
- #endif
-
- #ifndef FRAME_H
- #include "Frame.h"
- #endif
-
- // ----- Framework Layer -----
- #ifndef FWCONTXT_H
- #include "FWContxt.h" // FW_CViewContext
- #endif
-
- #ifndef FWEVENT_H
- #include "FWEvent.h" // FW_CMenuEvent, FW_CMouseEvent
- #endif
-
- #ifndef FWEVENTU_H
- #include "FWEventU.h" // FW_IsCommandKeyPressed
- #endif
-
- // ----- OS Layer -----
- #ifndef FWRECSHP_H
- #include "FWRecShp.h" // FW_CRectShape
- #endif
-
- //========================================================================================
- #ifdef FW_BUILD_MAC
- #pragma segment Data
- #endif
-
- FW_DEFINE_AUTO(CDataFrame)
-
- //========================================================================================
- CDataFrame::CDataFrame(Environment* ev, ODFrame* odFrame,
- FW_CPresentation* presentation, CDataContent* content)
- : FW_CFrame(ev, odFrame, presentation, content->GetPart(ev)),
- fDataContent(content)
- {
- }
-
- //----------------------------------------------------------------------------------------
- CDataFrame::~CDataFrame()
- {
- }
-
- //----------------------------------------------------------------------------------------
- void
- CDataFrame::Draw(Environment *ev, ODFacet* odFacet, ODShape* invalidShape) // Override
- {
- FW_CViewContext context(ev, this, odFacet, invalidShape);
- FW_CRect invalidRect = FW_GetShapeBoundingBox(ev, invalidShape);
- FW_CRect frameRect = this->GetBounds(ev);
- FW_CRectShape::RenderRect(context, invalidRect, FW_kFill, FW_kRGBLightGray);
-
- // draw pizzas
- CPizzaCollection* list = fDataContent->MyGetPizzaList();
- CPizzaCollectionIterator iter(list);
- CPizza* pizza = NULL;
- for (pizza = iter.First(); iter.IsNotComplete(); pizza = iter.Next())
- {
- if (::FW_IsCommandKeyPressed())
- pizza->Draw(context);
- else
- if (invalidRect.IsIntersecting( pizza->GetBounds() ) )
- pizza->Draw(context);
- }
- }
-
- //----------------------------------------------------------------------------------------
- FW_Handled
- CDataFrame::DoMouseDown(Environment* ev, const FW_CMouseEvent& theMouseEvent)
- {
- FW_CPoint where = theMouseEvent.GetMousePosition(ev, FW_CMouseEvent::kFrame);
- this->GetContentView(ev)->FrameToViewContent(ev, where);
- fDataContent->MyIncrement(ev, where);
- return true;
- }
-
-